With the development of information technology, more and more image or video files with a vivid and intuitive display effect are used as substitutes for traditional text files to record and transmit information, and the amount of information is getting bigger and bigger. Since the data amount of images and videos is very great, the storage and transmission thereof are quiet inconvenient, thus an effective compression on the data is necessary for either storage or transmission.
Image compression is an application of data compression technology to digital images. Its purpose is to reduce redundant information in image data so as to store and transmit data in highly effective formats, which has great significance in rapid transmission and real time processing of digital image information on the network.
The reason why image data can be compressed is that there exists redundancy in the data. Redundancies in image data can be mainly classified into spatial redundancy caused by the correlations between adjacent pixels in an image, temporal redundancy caused by the correlations between different frames in an image sequence, and spectrum redundancy caused by the correlations between different color planes or spectral bands. The purpose of data compression is to reduce the data redundancies so as to reduce the number of bits required for representing the data.
In image compression applications, the ideal compression is a compression with an effect of low image capacity and high image quality (definition), which can be realized by choosing a suitable output format according to the characteristics of an image. Image formats used in the Internet mainly include GIF format, PNG format and JPG format, wherein JPG format is a lossy compression format, it is suitable for compression and storage of images having complicated colors such as landscape images, but can lead to loss of image data; GIF format and PNG format are image compression formats based on color pallet technology, and the number of colors adopted when an image is compressed with GIF and PNG formats is a very important compression parameter. As far as a GIF or PNG formatted image is concerned, the file size of the image can be effectively reduced with the display effect thereof kept substantially unchanged by appropriately adjusting the number of colors of the image.
At present, images are generally compressed according to a predetermined number of colors, rather than the numbers of colors suitably selected based on the characteristics of the images, in computer image conversion. Under such a circumstance, images having different or even very different numbers of colors are compressed according to a same predetermined compression parameter rather than the actual numbers of colors of the images, which leads to either a case where the number of colors is set too high and thus the compression efficiency is not high, or a case where the number of colors is set too low and thus the display effect is not good, therefore, the file size and the display effect of the compressed images cannot be well balanced.